<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::group(['middleware'=>'jwt.auth'],function () {
Route::get('cars/area/show', 'Car\CarAreaController@area');  //车辆区域下部件下车辆类型下车辆
Route::group(['prefix' => 'patrol'], function () {  //巡查任务
    Route::resource('task', 'Car\PatrolTaskController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
    Route::resource('type', 'Car\PatrolTypeController', ['only' => [  //巡查任务类型
        'index', 'show'
    ]]);
});
Route::group(['prefix' => 'region'], function () {  //  区域环卫人员
    Route::resource('sanitation', 'Car\SanitationStaffController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
    Route::resource('green', 'Car\GreenStaffController', ['only' => [  //区域绿化人员
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});
Route::group(['prefix' => 'greentask'], function () {
    Route::resource('green', 'Car\GreenTaskController', ['only' => [ //  绿化任务量分析
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {

    Route::resource('kind', 'Car\CarKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'chat','middleware'=>'token'], function () {
    Route::resource('groups', 'Chat\ChatGroupController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
    Route::resource('messages', 'Chat\ChatMessagesController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('city', 'Car\CarCityController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('area', 'Car\CarAreaController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('info', 'Car\CarInfoController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);

});


Route::group(['prefix' => 'excel'], function () {
    Route::get("car/info/",'Car\CarInfoController@export');// 车辆信息excel 导出 测试用
    Route::get("car/check/",'Car\CarCheckController@export');//车辆验收表 导出
    Route::get("car/checkrecord/",'Car\CarCheckRecordController@export');//车辆点检 导出
    Route::get("car/checkrecord/{id}",'Car\CarCheckRecordController@exportDetail');//车辆点检详细 导出
    Route::get("car/checkrecordprocess/",'Car\CheckRecordProcessController@export');//车辆项目点检 导出
    Route::get("garbage/reward/",'GarbageCollect\GarbageCollectRewardController@export');//垃圾回收物奖励设置
});


Route::group(['prefix' => 'cars'], function () {
    Route::post('pic', 'Car\CarInfoPicController@store');
});


Route::group(['prefix' => 'equipments'], function () {
    Route::resource('equipments', 'Car\CarEquipmentController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'equipments'], function () {
    Route::resource('equipmentkind', 'Car\CarEquipmentKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('components', 'Car\CarComponentController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('fuels', 'Car\CarFuelRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('maintence', 'Car\CarMaintenceRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('insurance', 'Car\CarInsuranceRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('insurancebill', 'Car\CarInsuranceRecordBillController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('rent', 'Car\CarRentController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('inspect', 'Car\CarCheckRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('inspectprocess', 'Car\CheckRecordProcessController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('year', 'Car\CarYearCheckRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('repair', 'Car\CarRepairRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);

    Route::resource('repairedetail', 'Car\CarRepairRecordDetailController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});



Route::group(['prefix' => 'cars'], function () {
    Route::resource('punishment', 'Car\CarPunishController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('accident', 'Car\CarAccidentRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

//CarAccidentRecordDetailController

Route::group(['prefix' => 'cars'], function () {
    Route::resource('accidentdetail', 'Car\CarAccidentRecordDetailController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('task/kind/info', 'Car\EquipmentTaskKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('task/kind/detail', 'Car\EquipmentTaskDetailKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('task/info', 'Car\EquipmentTaskRecordController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'cars'], function () {
    Route::resource('preparation/levels', 'Car\CarStayTimeLevelController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('preparation/info', 'Car\CarPreparationController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'cars'], function () {
    Route::resource('check', 'Car\CarCheckController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('collections/kind', 'GarbageCollect\GarbageKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'garbage'], function () {

    Route::resource('collections/info', 'GarbageCollect\GarbageCollectRewardController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('goods/kinds', 'GarbageCollect\GarbageGoodKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('goods/info', 'GarbageCollect\GarbageGoodInfoController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'garbage'], function () {
    Route::resource('retrieve/orders', 'GarbageCollect\GarbageRetrieveOrderController', ['only' => [
        'index', 'show', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('retrieve/order/kinds', 'GarbageCollect\GarbageRetrieveOrderKindController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('news', 'GarbageCollect\GarbageDissminateNewsController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});
Route::group(['prefix' => 'garbage'], function () {
    Route::resource('members/users', 'GarbageCollect\GarbagePointUsersController', ['only' => [
        'index',
    ]]);
});
Route::group(['prefix' => 'garbage'], function () {
    Route::resource('members/points', 'GarbageCollect\GarbagePointController', ['only' => [
        'index', 'show',
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('events', 'GarbageCollect\GarbageEventsController', ['only' => [
        'index', 'show'
    ]]);
});

Route::post('files/event', 'GarbageCollect\GarbageEventsFilesController@store');


Route::group(['prefix' => 'garbage'], function () {
    Route::resource('follows', 'GarbageCollect\GarbageInteractionFollowController', ['only' => [
        'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'garbage'], function () {
    Route::resource('problems', 'GarbageCollect\GarbageInteractionController', ['only' => [
        'index', 'show', 'update', 'destroy'
    ]]);
});


Route::group(['prefix' => 'garbage'], function () {
    Route::resource('test', 'GarbageCollect\TestMongoController', ['only' => [
        'store', 'update', 'destroy'
    ]]);
    Route::post('files/event', 'GarbageCollect\GarbageEventsFilesController@store');
});

Route::group(['prefix' => 'file'], function () {
    Route::post('file', 'Api\FilesController@store');


});




Route::group(['prefix' => 'cars'], function () {

    Route::resource('tasks', 'Car\CarTaskController', ['only' => [
        'index', 'show', 'store','update','destroy'
    ]]);

    Route::delete('tasks/destroy/{ids}', 'Car\CarTaskController@delete');
});


Route::group(['prefix' => 'garbage'], function () {
    Route::resource('weichat/card', 'GarbageCollect\GarbageCardController', ['only' => [
        'index', 'show', 'store', 'update', 'destroy'
    ]]);
});

Route::group(['prefix' => 'weichat'], function () {
    //微信积分发送
        Route::post('reward', 'Api\WeiController@pointPost');
});


Route::group(['prefix' => 'algorithm'], function () {
    //算法 路径规划
    Route::get('path', 'Car\CarPathController@index');
});

Route::group(['prefix' => 'chat'], function () {
    //测试登录
    Route::post('login', 'Api\LoginController@jwtLogin');
    Route::post('applogin', 'Api\LoginController@appLogin');
});

Route::group(['prefix'=>'app'],function (){
    //获取uid
    Route::get('uid','Api\LoginController@scanLoginUid');
});

Route::group(['prefix'=>'app','middleware'=>'token'],function (){
    //获取uid
    Route::get('scan/login','Api\LoginController@scanLogin');
});


//websocket数据格式生成系统
Route::group(['prefix' => 'chat'], function () {
    //测试登录
    Route::get('foo', 'Chat\ChatFooController@index');
});

//websocket数据格式生成系统
Route::group(['prefix' => 'chat','middleware'=>'token'], function () {
    //测试登录
    Route::get('test', 'Chat\ChatGroupController@index1');
});

//});

//微信接口 不要加权限
Route::group(['prefix' => 'weichat','middleware'=>'weiauth'], function () {
    //微信服务器验证接口
    Route::get('index', 'Api\WeiController@check');
    //微信服务器交互接口
    Route::post('index', 'Api\WeiController@recv');
    //设置公众号菜单
    Route::get('menu', 'Api\WeiController@menu');
    //商机对接 添加商机对接接口
    Route::post('problem', 'Api\WeiController@problems')->name('weichat.problem');
    //大件垃圾预约添加
    Route::post('recycle', 'Api\WeiController@recycle')->name('weichat.recyle');
    //大件垃预约批量查看
    Route::get('recycle', 'Api\WeiController@recycleList')->name('weichat.recyle');
    //大件垃预约批量查看
    Route::get('recycle/{id}', 'Api\WeiController@recycleDetail')->name('weichat.recyle');
    //查看可以购买的商品
    Route::get('goods', 'Api\WeiController@good')->name('weichat.purchase');
    //查看可以购买的商品详细
    Route::get('goods/{id}', 'Api\WeiController@goodDetail')->name('weichat.purchase');
    //购买商品
    Route::post('goods', 'Api\WeiController@purchase')->name('weichat.purchase');
    //用户查看自己的所有订单
    Route::get('orders', 'Api\WeiController@userOrders')->name('weichat.orders');
    //用户删除订单
    Route::delete('orders/{id}', 'Api\WeiController@userOrdersDelete')->name('weichat.orders');
    //用户积分查看
    Route::get('points', 'Api\WeiController@userPoints')->name('weichat.points');
    //用户绑定卡号
    Route::post('cards', 'Api\WeiController@userCards')->name('weichat.cards');
    //用户政务服务器问题反馈
    Route::post('events', 'Api\WeiController@eventPost')->name('weichat.events');
    //用户信息
    Route::get('userinfo', 'Api\WeiController@userInfo')->name('weichat.userinfo');

    //二维码接口
    Route::get('qrcode', 'Api\WeiController@genCode')->name('weichat.qrcode');

    //获取code的回调接口
    Route::get('code', 'Api\WeiController@test');
    Route::get('test', 'Api\WeiController@test');
    //用户授权操作统一回调接口
    Route::get('authredirect', 'Api\WeiController@authRedirect');
    //统一授权服务器验证接口
    Route::get('MP_verify_qgW9bhl7h88RN5ez.txt', 'Api\WeiController@file');
    //前端测试获取token等三个参数
    Route::get('gettoken','Api\WeiController@webToken');
    //code到openid的转换接口
    Route::get('code2open','Api\WeiController@code2openId');
//    //扫一扫前端需要的api
    Route::get('scan','Api\WeiController@scan');
});
